home *** CD-ROM | disk | FTP | other *** search
- global gHasPathIni
-
- on setType
- global gType, gSlash
- if the machineType = 256 then
- set gType to #PC
- set gSlash to "\"
- else
- set gType to #MAC
- set gSlash to ":"
- end if
- end
-
- on getCDInfo x
- global gCDList
- if gCDList = [] then
- return "No Data Found,,Times,Plain"
- end if
- set theCD to getAt(gCDList, x)
- set title to getaProp(theCD, #cdTitle)
- set title2 to getaProp(theCD, #cdTitle2)
- set cdFont to getaProp(theCD, #cdFont)
- set style to getaProp(theCD, #cdFontStyle)
- return title & "," & title2 & "," & cdFont & "," & style
- end
-
- on fillFromOneVolume theVol, theID
- global gChapters, gCDList, gType, gSlash
- set ignoreThis to 0
- set cdPathName to EMPTY
- set testCD to FileIO(mnew, "read", theID)
- if objectp(testCD) then
- set cdinfo to testCD(mReadFile)
- testCD(mdispose)
- set cdType to 2
- set cdTitle to item 2 of cdinfo
- set cdTitle2 to item 3 of cdinfo
- set sep to item 9 of cdinfo
- if sep = EMPTY then
- set sep to "-"
- end if
- if (item 10 of cdinfo = "yes") or (gType = #MAC) then
- set onCD to 1
- else
- set onCD to 0
- end if
- set pctPath to item 11 of cdinfo
- set runOnCD to item 12 of cdinfo
- if cdTitle = "Russian" then
- set cdFont to "Cyrillic"
- set cdFontStyle to "Plain"
- set cdTitle to "Heccrbq zpsr"
- set cdTitle2 to "1"
- else
- set cdFont to "Times"
- set cdFontStyle to "Bold"
- if cdTitle = "Franais" then
- set cdTitle to "Français"
- else
- if cdTitle = "EspaΓÇôol" then
- set cdTitle to "Espa├▒ol"
- end if
- end if
- end if
- else
- set pctPath to EMPTY
- set runOnCD to EMPTY
- set sep to "-"
- set cdType to 1
- set cdFont to "Times"
- set cdFontStyle to "Bold"
- set CDDescs to "DEMO,ESPAÑOL,ENGLISH,FRANÇAIS,DEUTSCH"
- set CDLanguageList to "Demo,Español,English,Français,Deutsch"
- if gType = #MAC then
- set onCD to 1
- set CDTitles to "The Rosetta Stone,RS Español Ia,RS English Ia,RS Français Ia,RS Deutsch Ia"
- set numTitles to the number of items in CDTitles
- set ignoreThis to 1
- repeat with j = 1 to numTitles
- if theVol = item j of CDTitles then
- set cdTitle to item j of CDDescs
- set cdLanguage to item j of CDLanguageList
- if cdTitle = "DEMO" then
- set cdTitle2 to EMPTY
- else
- set cdTitle2 to "Level Ia"
- end if
- set ignoreThis to 0
- end if
- end repeat
- else
- set onCD to 0
- set CDFiles to "\russian_\russian_.01-,\espa_ol_\espa_ol_.01-,\english_\english_.01-,\fran_ais\fran_ais._01,\deutsch_\deutsch_.01-"
- set CDPathNameList to "demo,espa_ol_\,english_\,fran_ais\,deutsch_\"
- set numTitles to the number of items in CDFiles
- set ignoreThis to 1
- repeat with j = 1 to numTitles
- set testCD to FileIO(mnew, "read", theVol & item j of CDFiles)
- if objectp(testCD) then
- testCD(mdispose)
- set cdTitle to item j of CDDescs
- set cdLanguage to item j of CDLanguageList
- if cdTitle = "DEMO" then
- set cdTitle2 to EMPTY
- else
- set cdTitle2 to "Level Ia"
- end if
- set cdPathName to item j of CDPathNameList
- set ignoreThis to 0
- exit repeat
- end if
- end repeat
- end if
- end if
- if ignoreThis = 0 then
- add(gCDList, [#path: theVol & gSlash, #type: cdType, #Separator: sep, #TextonCD: onCD, #cdTitle: cdTitle, #cdTitle2: cdTitle2, #cdFont: cdFont, #cdFontStyle: cdFontStyle, #cdPathName: cdPathName, #pctPath: pctPath, #runOnCD: runOnCD])
- set cdindex to count(gCDList)
- if cdType = 1 then
- if cdTitle = "DEMO" then
- set chaps to "English 01-01,English 01-02,English 01-03,English 01-07,English 01-10,English 02-10,English 03-07,English 06-05,English 08-08,English 08-12,English 13-03,English 14-01,Deutsch 01-01,Deutsch 01-02,Deutsch 01-03,Deutsch 01-07,Deutsch 01-10,Deutsch 02-10,Deutsch 03-07,Deutsch 06-05,Deutsch 08-08,Deutsch 08-12,Deutsch 13-03,Deutsch 14-01,Français 01-01,Français 01-02,Français 01-03,Français 01-07,Français 01-10,Français 02-10,Français 03-07,Français 06-05,Français 08-08,Français 08-12,Français 13-03,Français 14-01,Español 01-01,Español 01-02,Español 01-03,Español 01-07,Español 01-10,Español 02-10,Español 03-07,Español 06-05,Español 08-08,Español 08-12,Español 13-03,Español 14-01,Russian 01-01,Russian 01-02,Russian 01-03,Russian 01-07,Russian 01-10,Russian 02-10,Russian 03-07,Russian 06-05,Russian 08-08,Russian 08-12,Russian 13-03,Russian 14-01"
- repeat with i = 1 to the number of items in chaps
- set aChap to [#chap: item i of chaps, #cd: cdindex]
- add(gChapters, aChap)
- end repeat
- else
- repeat with i = 1 to 8
- repeat with j = 1 to 12
- set aChap to [#chap: cdLanguage & " " & pad(i) & "-" & pad(j), #cd: cdindex]
- if (i > 4) or (j < 12) then
- add(gChapters, aChap)
- end if
- end repeat
- end repeat
- end if
- else
- if gType = #MAC then
- set catname to "catmac.trs"
- else
- set catname to "catmpc.trs"
- end if
- set testCD to FileIO(mnew, "read", theVol & gSlash & catname)
- if objectp(testCD) then
- set chaps to testCD(mReadFile)
- testCD(mdispose)
- repeat with i = 1 to the number of lines in chaps
- set c to line i of chaps
- if the last word in c = "CD" then
- set l to length(c)
- delete char l - 2 to l of c
- end if
- if word 1 of c = "Franais" then
- set c to "Français " & word 2 of c
- else
- if word 1 of c = "EspaΓÇôol" then
- set c to "Espa├▒ol " & word 2 of c
- end if
- end if
- if c <> EMPTY then
- set aChap to [#chap: c, #cd: cdindex]
- add(gChapters, aChap)
- end if
- end repeat
- end if
- end if
- end if
- end
-
- on findChapLocs
- global gCDList, gChapters, gType, gAnnounceText, gXobj
- set gCDList to []
- set gChapters to []
- if gType = #MAC then
- set volumeList to getVolumes()
- else
- set volumeList to "c:,d:,e:,f:,g:,h:,i:,j:,k:,l:,m:,n:,o:,p:,q:,r:,s:,t:,u:,v:,w:,x:,y:,z:"
- gXobj(mErrorMode, 1)
- end if
- set testCD to FileIO(mnew, "read", the pathName & "path.ini")
- if objectp(testCD) then
- set gHasPathIni to 1
- set the itemDelimiter to "@"
- set PathFile to testCD(mReadFile)
- testCD(mdispose)
- set alsoaPath to item 1 of PathFile
- if gType = #PC then
- if not (alsoaPath contains ":") then
- set testCD to FileIO(mnew, "read", the pathName & "CHAPTERS\CHAPTERS.INI")
- if objectp(testCD) then
- set iniEntry to testCD(mReadFile)
- testCD(mdispose)
- set alsoaPath to char offset("=", iniEntry) + 1 of iniEntry & ":\" & alsoaPath
- end if
- end if
- end if
- delete item 1 of PathFile
- set the itemDelimiter to numToChar(10)
- set gAnnounceText to EMPTY
- repeat with i = 1 to the number of items in PathFile
- put item i of PathFile after gAnnounceText
- end repeat
- set the itemDelimiter to ","
- set volumeList to alsoaPath & "," & volumeList
- else
- set gAnnounceText to EMPTY
- set gHasPathIni to 0
- end if
- set numTitles to the number of items in volumeList
- set j to 1
- set dirListCD to EMPTY
- repeat while j <= numTitles
- set theTry to item j of volumeList
- set isOurs to 1
- if gType = #MAC then
- set theID to theTry & ":" & "CDID.TRS"
- set testCD to FileIO(mnew, "read", theTry & ":" & "The Rosetta Stone:Rosetta Prefs")
- if not objectp(testCD) then
- set testCD to FileIO(mnew, "read", theTry & ":" & "The Rosetta Stone Folder:Rosetta Prefs")
- if not objectp(testCD) then
- set testCD to FileIO(mnew, "read", theID)
- if not objectp(testCD) then
- set isOurs to 0
- end if
- end if
- end if
- else
- set theID to theTry & "\" & "CDID.TRS"
- set testCD to FileIO(mnew, "read", theTry & "\" & "license-.-re")
- if not objectp(testCD) then
- set testCD to FileIO(mnew, "read", theID)
- if not objectp(testCD) then
- set isOurs to 0
- end if
- end if
- end if
- if objectp(testCD) then
- testCD(mdispose)
- end if
- if isOurs then
- fillFromOneVolume(theTry, theID)
- end if
- set j to j + 1
- end repeat
- if (gType = #PC) and objectp(gXobj) then
- gXobj(mErrorMode, 0)
- end if
- end
-
- on findChapPaths language, unit, chapter
- global gChapters, gCDList, gType, gSlash
- set pathList to [:]
- set chapName to language & " " & pad(unit) & "-" & pad(chapter)
- set n to count(gChapters)
- repeat with i = 1 to n
- set aChap to getAt(gChapters, i)
- if getaProp(aChap, #chap) = chapName then
- set cd to getaProp(aChap, #cd)
- set theCD to getAt(gCDList, cd)
- set basePath to getaProp(theCD, #path)
- set chapType to getaProp(theCD, #type)
- set textPlace to getaProp(theCD, #TextonCD)
- set sep to getaProp(theCD, #Separator)
- set word2 to word 2 of chapName
- set title to getaProp(theCD, #cdTitle)
- set pctPath to getaProp(theCD, #pctPath)
- if pctPath = EMPTY then
- set pctPath to char 1 to 3 of chapName
- end if
- if chapType = 2 then
- set chapPath to basePath & char 1 to 3 of chapName & char 1 to 2 of word2 & sep & char 4 to 5 of word2 & gSlash
- set chapPctPath to basePath & pctPath & char 1 to 2 of word2 & sep & char 4 to 5 of word2 & gSlash
- else
- if gType = #MAC then
- set chapPath to basePath & chapName & gSlash
- else
- set chapPath to basePath & char 1 to 8 of chapName & gSlash
- end if
- set chapPctPath to chapPath
- end if
- if textPlace = 1 then
- set textPath to chapPath
- else
- set textPath to the pathName & "text\" & char 1 to 3 of title & "text\"
- end if
- if chapType = 1 then
- set index to unit & "-" & pad(chapter)
- if gType = #MAC then
- setaProp(pathList, #textPath, textPath & chapName)
- setaProp(pathList, #pictpath, chapPath & index & " Pictures:" & index & "-")
- setaProp(pathList, #pictsuffix, EMPTY)
- setaProp(pathList, #sndpath, chapPath & index & " Sounds:" & index & "-")
- setaProp(pathList, #sndsuffix, EMPTY)
- else
- set oldBase to getaProp(theCD, #cdPathName)
- if oldBase = "demo" then
- if language = "Espa├▒ol" then
- set oldBase to "espa_ol_\"
- else
- if language = "English" then
- set oldBase to "english_\"
- else
- if language = "Français" then
- set oldBase to "fran_ais\"
- else
- if language = "Deutsch" then
- set oldBase to "deutsch_\"
- else
- if language = "Russian" then
- set oldBase to "russian_\"
- end if
- end if
- end if
- end if
- end if
- end if
- setaProp(pathList, #textPath, textPath & char 1 to 3 of chapName & pad(unit) & "_" & pad(chapter))
- setaProp(pathList, #pictpath, basePath & oldBase & index & "_Pic\" & index & "-")
- setaProp(pathList, #pictsuffix, EMPTY)
- setaProp(pathList, #sndpath, basePath & oldBase & index & "_Sou\" & index & "-")
- setaProp(pathList, #sndsuffix, EMPTY)
- end if
- else
- set prefix to char 1 to 2 of chapName
- set index to pad(unit) & pad(chapter)
- if textPlace = 1 then
- if gType = #MAC then
- setaProp(pathList, #textPath, textPath & prefix & index & ".TXT")
- else
- setaProp(pathList, #textPath, textPath & prefix & index & ".TXT")
- end if
- else
- setaProp(pathList, #textPath, textPath & char 1 to 3 of chapName & char 1 to 2 of index & "_" & char 3 to 4 of index)
- end if
- setaProp(pathList, #pictpath, chapPctPath & char 1 to 2 of pctPath & index & "P" & gSlash & char 1 to 2 of pctPath & index)
- setaProp(pathList, #pictsuffix, ".PCT")
- setaProp(pathList, #sndpath, chapPath & prefix & index & "S" & gSlash & prefix & index)
- setaProp(pathList, #sndsuffix, ".SND")
- end if
- setaProp(pathList, #type, chapType)
- return pathList
- end if
- end repeat
- return [:]
- end
-
- on makeImagePath pathList, which, index
- global gPatchSnd
- if which = #PICT then
- set basePath to getaProp(pathList, #pictpath)
- set suffix to getaProp(pathList, #pictsuffix)
- else
- if (gPatchSnd = 1) and (index = 28) then
- set index to 37
- end if
- if (gPatchSnd = 1) and (index = 39) then
- set index to 25
- end if
- set basePath to getaProp(pathList, #sndpath)
- set suffix to getaProp(pathList, #sndsuffix)
- end if
- return basePath & pad(index) & suffix
- end
-
- on isRunningOnCD
- global gCDList
- if gHasPathIni = 1 then
- return 0
- end if
- set n to count(gCDList)
- repeat with i = 1 to n
- set aCD to getAt(gCDList, i)
- if getaProp(aCD, #runOnCD) <> "runOnCD" then
- set basePath to getaProp(aCD, #path)
- if (basePath & "The Rosetta Stone:") = the pathName then
- return 1
- end if
- if (basePath & "The Rosetta Stone Folder:") = the pathName then
- return 1
- end if
- end if
- end repeat
- return 0
- end
-
- on getAllChaps
- global gChapters
- set n to count(gChapters)
- set ret to EMPTY
- repeat with i = 1 to n
- set aChap to getAt(gChapters, i)
- set chap to getaProp(aChap, #chap)
- put chap & RETURN after ret
- end repeat
- set l to the number of chars in ret
- delete char l of ret
- return ret
- end
-